package com.luo.bbs.front.webapi.controller;


import com.example.bbs.front.service.ITagService;
import com.luo.common.restful.JsonResult;

import com.luo.pojo.tag.entity.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author bin.cn
 * @since 2023-01-19
 */
@RestController
@RequestMapping("/tag")
public class TagController {
    @Autowired
    private ITagService tagService;

    /**
     * 获取版块列表
     * @return
     */
    @GetMapping("/list")
    public JsonResult<List<Tag>> getTagList(){
        List<Tag> tags = tagService.listTag();
        return JsonResult.ok(tags);
    }

    /**
     * 获取版块详情
     */
    @GetMapping("/detail/{id}")
    public JsonResult getTagDetail(@PathVariable Integer id){
        Tag tag = tagService.getTagDetail(id);
        return JsonResult.ok(tag);
    }


}
